package com.endava.Parsing;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Parsing {
	public static void main(String[] args) {
		Pattern p=Pattern.compile("ab");//the expression
		Matcher m=p.matcher("abaaaba");//the source
		
		while(m.find()){
			System.out.println(m.start()+" "+m.group());
		}
	}
	/*Result
	 * 0 ab
	 * 4 ab
	 */
}
